﻿@model ShiXuLong.Model.Address

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>AddUserAddressView</title>
    <script src="~/scripts/jquery-3.5.1.js"></script>
    <script src="~/lib/layui/layui.js"></script>
</head>
<body>
    <div>
        @using (Ajax.BeginForm("AddUserAddress", "Cart", new AjaxOptions { OnSuccess = "addComp" }))
        {
            @Html.HiddenFor(m => m.Id)
            @Html.HiddenFor(m => m.UserId)
            <input hidden type="text" name="UserId" value="" />
            <div class="layui-form-item">
                @Html.Label("用户地址")
                @Html.EditorFor(m => m.UserAddress)
                @Html.ValidationMessageFor(m => m.UserAddress)
            </div>
            <div class="layui-form-item">
                @Html.Label("省份")
                @Html.EditorFor(m => m.Province)
                @Html.ValidationMessageFor(m => m.Province)
            </div>
            <div class="layui-form-item">
                @Html.Label("城市")
                @Html.EditorFor(m => m.City)
                @Html.ValidationMessageFor(m => m.City)
            </div>
            <div class="layui-form-item">
                @Html.Label("县/乡")
                @Html.EditorFor(m => m.County)
                @Html.ValidationMessageFor(m => m.County)
            </div>
            <button>提交</button>
        }
    </div>
    <script>
            
            layui.use(['form', 'laydate', 'layer', 'upload', 'layedit'], function () {
                var form = layui.form;
                var laydate = layui.laydate;
                var upload = layui.upload;
                var layer = layui.layer;
                var layedit = layui.layedit;
                var $ = layui.$;
                function addComp(re) {
                    if (re.success) {
                        parent.layer.msg(re.msg);
                    
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    } else {
                        parent.layer.msg(re.msg);
                    }
                }
              

            });
    </script>
</body>
</html>
